package cn.itsource.order.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.order.service.IOrderAdoptService;
import cn.itsource.pay.domain.OrderDto;
import cn.itsource.pay.domain.PayDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/adoptOrder")
@Slf4j
public class OrderAdoptController {

    @Autowired
    private IOrderAdoptService orderAdoptService;

    /**
     * 下单，并且跳转到支付页面
     * 接受：1.用户地址id  2.商品id
     * @return
     */
    @PostMapping("/submitOrder")
    public AjaxResult submitOrder(@RequestBody OrderDto orderDto){
        //下单
        return AjaxResult.createSuccess(orderAdoptService.submitOrder(orderDto));
    }

}
